package com.salary.model
import net.liftweb.common.Full
import net.liftweb.mapper._

import net.liftweb.mapper.{By,MegaProtoUser,MetaMegaProtoUser}

/**
 * The singleton that has methods for accessing the database
 */
object User extends User with MetaMegaProtoUser[User] {
  override def dbTableName = "users" // define the DB table name
  
  // Just for testing purposes. In production we remove this
  override def skipEmailValidation = true

  // Spruce up the forms a bit
  override def screenWrap = 
    Full(<lift:surround with="default" at="content"><div id="formBox"><lift:bind /></div></lift:surround>)

  // define the order fields will appear in forms and output
  //override def fieldOrder = id :: firstName :: lastName :: email :: password :: Nil
  override def fieldOrder = List(id, firstName, lastName, email,
  locale, timezone, password, operation)
}

/**
 * An O-R mapped "User" class that includes first name, last name, password and we add a "Personal Essay" to it
 */
class User extends MegaProtoUser[User] {
  def getSingleton = User // what's the "meta" server
  
  object operation extends MappedInt(this)
}
